#ifndef ANALYSE_H
#define ANALYSE_H

#include <QtCore/qglobal.h>
#include<vector>


class  Analyse
{
public:
    Analyse();

    double yingB(int *Fla,double *FLb,int len ) ; //计算B序列
    double yingA(double *FLa,double *FHa); //计算A序列
    double yingN(double *YingN, double yingaavg, double yingbbvg);  //计算拟合函数
    double yingX(double *YingNF, double *YingX,double yingNAvg); //计算衰减系数
    double yingJ(double *YingJ, double *YingFJ); //计算衰减系数后曲线数据
    double IIR_Init(double *Fla,double *Flb,double IIR_c[5][5]); //计算SG三阶5点滤波

    double II_Seven(double *Fla,double *Flb,double IIR_c[7][7]); //计算SG二阶7点滤波-2023年10月11日

    double yingFDM(double *yingLvbo, double *FDM); //计算FDM数值最大差值
    double yingSDM(double *FMD,double *SDM); //计算SDM最大差值
    double lvboAVG(double *YingLvbo);// 计算基线3-15个循环
    double yingK(double e); //计算扩增斜率
    double K_slope(double *Fla,double *Flb,int len,int m); //计算扩增效率
    double yingCT(double K, double CFDM, double Rmax, double Rjixian); //计算扩增CT值
    double Exp_Curve(double *Fla ,double *Rn,double Scope ,int C0,int Cm) ;
    double delta(double *yingLvbo,double *jixianF,double yingJAvg);
    double xunhuanS(double *yingLvbo,int start, int end); //计算数值偏差s
    double yingCTJiao(double *yingLvbo, double yuzhi, int end); //相交法计算CT
    double yingCTSigmoid(double yuzhi, double bejing,double k, double maxLvbo);

    double yingBase(double *yingBase); //原始荧光值去掉前三个循环值计算
    double yingFour(double *YingFour); //计算原始荧光数据预处理前三个循环与第四个循环一致

    double normalize(double *yingLvbo, double *narm); //基于滤波后数据进行归一化处理
    double normalizeN(double *nihe, double *narm); //基于拟合后数据进行归一化处理
    double sigmod(double *yingLvbo, double k,double *yingSigmod); //计算滤波后荧光数据拟合
    double eff(double *Fla,double *Flb,int len,int m); //基于拟合后数据计算效率和斜率
    double sigmodDelta(double maxLvbo,double *yingLvbo,double k, double *yingSigmod, double d);

    void interpolation(double *p);//原始荧光数据异常数据处理
    double standardDev(double *p); //计算标准偏差

    double logarithm(double *RnYing,double *RnYingF); //计算log值
    double LinearFit(double *yingLvbo);

    double Standards(double ctArr[], double conArr[],int size);//根据标准品计算效率 斜率 截距 R²
    std::vector<double> Concentration(double ctUnkownArr[], int size);//计算未知样品浓度
    double allmethod(double roxn, double vicn, double famn, QVector<double> cq, double cqv); //计算样品抑制情况


    int leh;
    int start = 3; //定义基线开始循环数s
    int end = 15; //定义基线结束循环数
    double yingBAvg; //定义B序列的每组的荧光值的平均值
    double yingAAvg; //定义A序列的每组的荧光值的平均值
    double yingNAvg; //定义拟合每组荧光值的平均值
    double yingJAvg; //基线平均值
    double XAvg; //定义循环数平均数
    double XS;
    int *p; //定义原始荧光数组指针
    double maxLvbo;
    int c0;
    int c0SDM;
    int std;

    double maxK=0;
    double maxB=0;
    double rr2=0;

    double LvStd = 0; //定义滤波后荧光数据的偏差值

    double standardK=0.0;
    double standardYInt=0.0;
    double rSquared=0.0;
    double efficiency=0.0;

    double manQuantity=0;
    double womanQuantity=0;
    double Quantityb=0;
    double DI=0;
    double ICS=0;
private:
    int avgStart  = 1 ;
    int avgEnd = 7;
//    int start = 3; //定义基线开始循环数s
//    int end = 15; //定义基线结束循环数

    double array[5][5] ;
    double k; //定义扩增斜率
    double d=1.1; //拟合曲线形状

};

class  Analyses
{
public:
    Analyses();

};

#endif // ANALYSE_H
